package com.zhiyou100.taxi.entity;

import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

public class Car implements Serializable {
    public Car() {
    }

    public Car(String carId, String carLogo, String carNumber,
               Date carTime, BigDecimal carZuo, String carColor,
               BigDecimal carPrice, String carPhoto, BigDecimal carStatus) {
        this.carId = carId;
        this.carLogo = carLogo;
        this.carNumber = carNumber;
        this.carTime = carTime;
        this.carZuo = carZuo;
        this.carColor = carColor;
        this.carPrice = carPrice;
        this.carPhoto = carPhoto;
        this.carStatus = carStatus;
    }

    private String carId;

    private String carLogo;

    private String carNumber;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date carTime;

    private BigDecimal carZuo;

    private String carColor;

    private BigDecimal carPrice;

    private String carPhoto;

    private BigDecimal carStatus;

    private static final long serialVersionUID = 1L;

    public String getCarId() {
        return carId;
    }

    public void setCarId(String carId) {
        this.carId = carId == null ? null : carId.trim();
    }

    public String getCarLogo() {
        return carLogo;
    }

    public void setCarLogo(String carLogo) {
        this.carLogo = carLogo == null ? null : carLogo.trim();
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber == null ? null : carNumber.trim();
    }

    public Date getCarTime() {
        return carTime;
    }

    public void setCarTime(Date carTime) {
        this.carTime = carTime;
    }

    public BigDecimal getCarZuo() {
        return carZuo;
    }

    public void setCarZuo(BigDecimal carZuo) {
        this.carZuo = carZuo;
    }

    public String getCarColor() {
        return carColor;
    }

    public void setCarColor(String carColor) {
        this.carColor = carColor == null ? null : carColor.trim();
    }

    public BigDecimal getCarPrice() {
        return carPrice;
    }

    public void setCarPrice(BigDecimal carPrice) {
        this.carPrice = carPrice;
    }

    public String getCarPhoto() {
        return carPhoto;
    }

    public void setCarPhoto(String carPhoto) {
        this.carPhoto = carPhoto == null ? null : carPhoto.trim();
    }

    public BigDecimal getCarStatus() {
        return carStatus;
    }

    public void setCarStatus(BigDecimal carStatus) {
        this.carStatus = carStatus;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Car other = (Car) that;
        return (this.getCarId() == null ? other.getCarId() == null : this.getCarId().equals(other.getCarId()))
                && (this.getCarLogo() == null ? other.getCarLogo() == null : this.getCarLogo().equals(other.getCarLogo()))
                && (this.getCarNumber() == null ? other.getCarNumber() == null : this.getCarNumber().equals(other.getCarNumber()))
                && (this.getCarTime() == null ? other.getCarTime() == null : this.getCarTime().equals(other.getCarTime()))
                && (this.getCarZuo() == null ? other.getCarZuo() == null : this.getCarZuo().equals(other.getCarZuo()))
                && (this.getCarColor() == null ? other.getCarColor() == null : this.getCarColor().equals(other.getCarColor()))
                && (this.getCarPrice() == null ? other.getCarPrice() == null : this.getCarPrice().equals(other.getCarPrice()))
                && (this.getCarPhoto() == null ? other.getCarPhoto() == null : this.getCarPhoto().equals(other.getCarPhoto()))
                && (this.getCarStatus() == null ? other.getCarStatus() == null : this.getCarStatus().equals(other.getCarStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCarId() == null) ? 0 : getCarId().hashCode());
        result = prime * result + ((getCarLogo() == null) ? 0 : getCarLogo().hashCode());
        result = prime * result + ((getCarNumber() == null) ? 0 : getCarNumber().hashCode());
        result = prime * result + ((getCarTime() == null) ? 0 : getCarTime().hashCode());
        result = prime * result + ((getCarZuo() == null) ? 0 : getCarZuo().hashCode());
        result = prime * result + ((getCarColor() == null) ? 0 : getCarColor().hashCode());
        result = prime * result + ((getCarPrice() == null) ? 0 : getCarPrice().hashCode());
        result = prime * result + ((getCarPhoto() == null) ? 0 : getCarPhoto().hashCode());
        result = prime * result + ((getCarStatus() == null) ? 0 : getCarStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", carId=").append(carId);
        sb.append(", carLogo=").append(carLogo);
        sb.append(", carNumber=").append(carNumber);
        sb.append(", carTime=").append(carTime);
        sb.append(", carZuo=").append(carZuo);
        sb.append(", carColor=").append(carColor);
        sb.append(", carPrice=").append(carPrice);
        sb.append(", carPhoto=").append(carPhoto);
        sb.append(", carStatus=").append(carStatus);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}